Skip to content

Refactor/402 : MCP 서버 fix stdio args#405

Merged
HeeMang-Lee merged 3 commits intodevfrom
refactor/402
Aug 12, 2025
Merged

Refactor/402 : MCP 서버 fix stdio args#405
HeeMang-Lee merged 3 commits intodevfrom
refactor/402

Conversation

@HeeMang-Lee
Copy link
Copy Markdown
Member

@HeeMang-Lee HeeMang-Lee commented Aug 12, 2025

🔎 작업 내용

  • Dockerfile: 런타임 이미지에 Node 22 설치, @brave/brave-search-mcp-server 글로벌 설치, server-brave-search 래퍼 스크립트 추가.
  • application.properties: args[0]=--transport, args[1]=stdio로 공식 문법 적용. (--stdio 단일 플래그 사용하지 않음)

Summary by CodeRabbit

  • 버그 수정

    • 서버 실행 스크립트를 bash 의존성 없이 /bin/sh 호환으로 개선해 다양한 환경에서 안정적으로 동작합니다.
    • Node 탐지를 강화해(command -v node → /usr/bin/node 폴백) 실행 실패 가능성을 줄였습니다.
    • 고정된 --transport stdio 옵션을 제거하여 전송 방식 설정이 가능해졌습니다.
  • 작업(Chores)

    • 컨테이너 빌드 시 실행 래퍼를 생성하고 실행 권한(0755)을 부여했습니다.
    • 설정의 인자 전달 방식을 정규화해 호환성과 가독성을 개선했습니다.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

이 PR은 cs25-service Dockerfile에서 Bash 기반 래퍼를 POSIX /bin/sh 스크립트로 교체하고, application.properties에서 Brave 연결 인자를 "--stdio"에서 ["--transport","stdio"]로 분리해 지정하도록 수정합니다. 그 외 빌드 단계는 변경되지 않았습니다.

Changes

Cohort / File(s) Summary of changes
Wrapper 스クリپ트 교체 (POSIX /bin/sh)
cs25-service/Dockerfile
빌드 시 /usr/local/bin/server-brave-search에 POSIX 쉘 스크립트를 생성. command -v node로 Node 탐색 후 dist/index.js 실행, 인자 전달($@), --transport stdio 하드코딩 제거, shebang을 #!/bin/sh로 변경, 실행권한 0755 설정.
Brave 인자 표기 변경
cs25-service/src/main/resources/application.properties
단일 "--stdio" 인자에서 "--transport","stdio"의 2개 인자로 변경. 기타 설정은 유지.

Sequence Diagram(s)

sequenceDiagram
    participant App as cs25-service
    participant Wrapper as /usr/local/bin/server-brave-search (/bin/sh)
    participant Node as node
    participant Brave as @brave/.../dist/index.js

    App->>Wrapper: invoke with args ["--transport","stdio", ...]
    Wrapper->>Node: node dist/index.js $@
    Node->>Brave: start MCP server
    Brave-->>App: communicates via stdio (per args)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • jong-0126
  • Ksr-ccb
  • Kimyoonbeom
  • crocusia
  • wannabeing

Poem

토끼는 쉘을 톡, POSIX로 깔끔히 점프!
바람처럼 인자 둘, “transport”와 “stdio” 쿵짝쿵짝—
배시 굴레 벗어 던지고, /bin/sh로 폴짝!
노드 길 잡아 별빛 따라, 브레이브를 콕!
삐빅! 래퍼 완성, 리뷰도 순삭 🥕✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/402

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
cs25-service/Dockerfile (1)

38-45: POSIX sh 래퍼로 전환 및 인자 위임("$@") 처리 적절. 사소한 견고성/이미지 슬림화 제안

현재 래퍼는 Node 탐색(fallback 포함)과 인자 위임이 올바르며, 애플리케이션 설정의 분리 인자와도 일관됩니다. 두 가지 소소한 개선을 권장합니다.

  • 래퍼 스크립트에 에러/미정의 변수 실패를 켜두면 향후 변경 시 방어력이 올라갑니다.
  • 런타임에서 bash를 직접 사용하지 않는다면 bash 패키지 설치를 제거해 이미지 크기/공격면을 줄일 수 있습니다. (이 변경은 본 변경 범위 밖이므로 참고용 예시를 덧붙입니다.)

래퍼 견고성 강화(변경 범위 내) 제안:

 && { \
-  echo '#!/bin/sh'; \
+  echo '#!/bin/sh'; \
+  echo 'set -eu'; \
   echo 'NODE=$(command -v node || echo /usr/bin/node)'; \
   echo 'exec "$NODE" "'"$SRCDIR"'/dist/index.js" "$@"'; \
 } > /usr/local/bin/server-brave-search \

이미지 슬림화(변경 범위 밖 참고용) 예시:

# 기존
apt-get install -y --no-install-recommends curl ca-certificates gnupg bash

# 제안: bash 미사용 시 제거
apt-get install -y --no-install-recommends curl ca-certificates gnupg
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd120df and d18f900.

📒 Files selected for processing (2)
  • cs25-service/Dockerfile (1 hunks)
  • cs25-service/src/main/resources/application.properties (1 hunks)
🔇 Additional comments (1)
cs25-service/src/main/resources/application.properties (1)

72-73: 검증 완료: --stdio 단일 플래그 잔여 사용처 없음

  • rg --fixed-strings -- '--stdio' 전역 검색 결과, 과거 단일 --stdio 플래그 사용 흔적이 없습니다.
  • Spring Boot properties에 설정된
    spring.ai.mcp.client.stdio.connections.brave.args[0]=--transport
    spring.ai.mcp.client.stdio.connections.brave.args[1]=stdio
    배열 인자 전달 방식은 순서를 유지하며 Dockerfile의 "$@" 래퍼를 통해 최종 실행 시 --transportstdio가 별도 인자로 정상 전달됩니다.

따라서 브레이브 MCP 인자 분리 적용은 합리적이며, 추가 조치 없이 머지 진행해도 좋습니다.

@HeeMang-Lee HeeMang-Lee merged commit c2980d6 into dev Aug 12, 2025
2 checks passed
@HeeMang-Lee HeeMang-Lee deleted the refactor/402 branch August 12, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant